<%@ page import="com.pml.factory.DAOFactory" %>
<%@ page import="com.pml.vo.Emp" %>
<%@ page import="java.util.List" %>
<%@ page import="java.util.Iterator" %><%--
  Created by IntelliJ IDEA.
  User: 迷路的麋鹿
  Date: 2018/4/21
  Time: 11:06
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>
<body>
<form action="list.jsp" method="post">
    搜索：<input type="text" name="keyword" >
    <input type="submit" >

</form>

<%

    String keyword=request.getParameter("keyword");
    if (keyword==null){
        keyword="";
    }
    request.setCharacterEncoding("GBK");
    List<Emp> list=DAOFactory.getEmpDAOInstance().findAll(keyword);
    Iterator<Emp> iterator=list.iterator();
%>
<table border="1">
    <tr>
        <td>雇员编号</td>
        <td>雇员姓名</td>
        <td>工作</td>
        <td>雇用日期</td>
        <td>工资</td>
    </tr>
<%
    while (iterator.hasNext()){
        Emp emp=iterator.next();
%>
<tr>
        <td><%=emp.getEmpno()%></td>
        <td><%=emp.getEname()%></td>
        <td><%=emp.getJob()%></td>
        <td><%=emp.getHiredate()%></td>
        <td><%=emp.getSal()%></td>
</tr>
<%
    }
%>
<table/>
</body>
</html>
